//
//  AddDeviceCommand.m
//  Shion
//
//  Created by Chris Karr on 9/11/08.
//  Copyright 2008 Northwestern University. All rights reserved.
//

#import "AddDeviceCommand.h"
#import "ShionAppDelegate.h"

@implementation AddDeviceCommand

- (id) performDefaultImplementation
{
	NSString * name = [self directParameter];

	NSString * address = [[self arguments] valueForKey:@"address"];
	BOOL dimmer = [[[self arguments] valueForKey:@"dimmer"] boolValue];
	
	if (name == nil || address == nil)
		return NO;
	
	NSMutableDictionary * note = [NSMutableDictionary dictionary];
	
	[note setValue:name forKey:NAME];
	[note setValue:address forKey:ADDRESS];
	[note setValue:[NSNumber numberWithBool:dimmer] forKey:DIMMER];
	
	[[NSNotificationCenter defaultCenter] postNotificationName:ADD_DEVICE object:self userInfo:note];
	
	return nil;
}

@end
